package tt.dz.biz.service.user;

import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import tt.dz.biz.dao.user.SystemInfoDAO;
import tt.dz.common.LogUtil;
import tt.dz.vo.SystemInfoVO;

@Service("systemInfoService")
public class SystemInfoService
{
  @Resource(name="systemInfoDAO")
  SystemInfoDAO systemInfoDAO;
  
  public SystemInfoVO querySystemInfoById(String sysCode)
  {
    return this.systemInfoDAO.querySystemInfoById(sysCode);
  }
  
  public List<SystemInfoVO> listAllSystemInfo()
  {
    List<SystemInfoVO> systemInfoList = null;
    try
    {
      systemInfoList = this.systemInfoDAO.listAllSystemInfo();
    }
    catch (Exception e)
    {
      LogUtil.error("查询业务系统对象列表异常", e);
      systemInfoList = new ArrayList();
    }
    return systemInfoList;
  }
  
  public List<SystemInfoVO> listAllValidSystemInfo()
  {
    List<SystemInfoVO> systemInfoList = null;
    try
    {
      systemInfoList = this.systemInfoDAO.listAllValidSystemInfo();
    }
    catch (Exception e)
    {
      LogUtil.error("查询业务系统对象列表异常", e);
      systemInfoList = new ArrayList();
    }
    return systemInfoList;
  }
  
  public boolean insertSystemInfo(SystemInfoVO systemInfoVO)
  {
    boolean excuteFlag = false;
    try
    {
      int i = this.systemInfoDAO.insertSystemInfo(systemInfoVO);
      excuteFlag = i > 0;
    }
    catch (Exception e)
    {
      LogUtil.error("插入业务系统对象异常--入参：" + systemInfoVO.toString(), e);
    }
    return excuteFlag;
  }
  
  public boolean updateSystemInfo(SystemInfoVO systemInfoVO)
  {
    boolean excuteFlag = false;
    try
    {
      int i = this.systemInfoDAO.updateSystemInfo(systemInfoVO);
      excuteFlag = i > 0;
    }
    catch (Exception e)
    {
      LogUtil.error("更新业务系统对象异常--入参：" + systemInfoVO.toString(), e);
    }
    return excuteFlag;
  }
}
